<?php

declare(strict_types=1);

/**
 * @Author:     Frank
 * @contact     frank_hhm@163.com
 * @Date:       2023-01-13 11:43:16
 * @Last Modified time: 2023-01-13 11:43:48
 */
namespace app\common\services\user;

use app\common\dao\user\UserGroupDao;

use frank\base\BaseService;
use frank\exception\CommonException;
use frank\utils\helper\ArrayHelper;

/**
 * Class UserGroupService
 */
class UserGroupService extends BaseService
{

    /**
     * UserGroupService constructor.
     * @param UserGroupDao $dao
     */
    public function __construct(UserGroupDao $dao)
    {
        $this->dao = $dao;
    }

    public function getUserGroupDetail($filter)
    {
        $detail = $this->dao->detail($filter);
        if (!$detail) {
            throw new CommonException('数据不存在');
        }
        return $detail->toArray();
    }

    /**
     * 获取列表
     */
    public function getUserGroupList(array $where)
    {
        [$page, $limit] = $this->getPageValue();
        $list = $this->dao->getUserGroupList($where, $page, $limit);
        return $list;
    }

    /**
     * 获取列表
     */
    public function getUserGroupSelect(array $where = [])
    {
        $select = $this->dao->getUserGroupSelect($where);
        return $select;
    }


}